﻿using System.Collections.Generic;
using AutoMapper;
using TRACv2.Domain.DTO;
using TRACv2.Domain.Interfaces.IRepository;
using TRACv2.Domain.Interfaces.IService;

//Author: Morgan William Davis III
//Project: TRAC Ticket Manager v2
//Date: 14 Mar 2014

namespace TRACv2.Domain.Services
{
    public class EmployeeService : IEmployeeService
    {
        #region [ Fields ]

        private readonly IEmployeeRepository _employeeRepository;

        #endregion

        #region [ Constructor ]

        public EmployeeService(IEmployeeRepository employeeRepository)
        {
            _employeeRepository = employeeRepository;
        }

        #endregion

        #region [ Methods ]

        public List<EmployeeDTO> GetAll()
        {
            return Mapper.Map<List<EmployeeDTO>>(_employeeRepository.GetAll());
        }

        public List<EmployeeDTO> GetByLastName(string lastname)
        {
            return Mapper.Map<List<EmployeeDTO>>(_employeeRepository.GetByLastName(lastname));
        }

        public EmployeeDTO GetByCode(string code)
        {
            return _employeeRepository.GetByCode(code);
        }

        public EmployeeDTO GetByID(int id)
        {
            return _employeeRepository.GetById(id);
        }

        #endregion
    }
}
